var pageii = null;
var grid = null;
$(function() {

	grid = lyGrid({
		pagId : 'paging',
		l_column : [{
			colkey : "cname",
			name : "客户名称"
		}, {
			colkey : "mold_encode",
			name : "模具编码"
		}, {
			colkey : "number",
			name : "订单数量"
		}, {
			colkey : "cangkNum",
			name : "库存数量"
		},{
			colkey : "client_weight",
			name : "客户定重"
		}, {
			colkey : "po_no",
			name : "采购订单号"
		}, {
			colkey : "client_encode",
			name : "客户编码"
		}, {
			colkey : "shipping_time",
			name : "出货时间",
			renderData : function(rowindex,data, rowdata, column) {
				return new Date(data).format("yyyy-MM-dd hh:mm:ss");
			}
		},{
		    colkey : "job_number",
			name : "作业号"
		},{
			colkey : "price",
			name : "单价"
		},{
			colkey : "sale",
			name : "业务员"
		},{
			colkey : "planner",
			name : "计划员"
		}],
		jsonUrl : rootPath + '/order/neworder_findByPage.shtml',
		dymCol:true,
		checkbox : true,
		serNumber : false
	});
	$("#editnewOrder").click("click", function() {
		editAccount();
	});
	$("#search").click("click", function() {// 绑定查询按扭
		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});
});
function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1) {
		layer.msg("只能选中一个");
		return;
	}
	if(cbox == ""){
		layer.msg("需要选择一个");
		return;
	}
	pageii = layer.open({
		title : "审核订单",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath + '/order/neworder_edit.shtml?id=' + cbox
	});
}
